home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************
- * BBitMapDoc.c
- *
- * SUPERCLASS = BDisplayOutput
- *
- * Class for rapid dumping of a bitmap to a window.
- *
- * © copyright 1992, KSS Scientific Consultants
- *
- ***********************************************************/
-
- #include <CDecorator.h>
- #include <CDesktop.h>
- #include <CScrollPane.h>
- #include <CWindow.h>
- #include <constants.h>
- #include "BBitMapDoc.h"
- #include "BBitMapPane.h"
-
- #define WINDculture 500 // Resource ID for WIND template
- #define BITMAPWIDTH 640
- #define BITMAPHEIGHT 480
-
- extern CDecorator *gDecorator;
- extern CDesktop *gDesktop;
-
- /************************************************************
- * IBBitMapDoc()
- *
- * Initialization method
- *
- ************************************************************/
-
- void BBitMapDoc::IBBitMapDoc(CApplication *aSupervisor, Boolean printable)
- {
- inherited::IBDisplayOutput(aSupervisor, printable);
- }
-
- /******************************************************************
- * BuildWindow
- *
- * Override BuildWindow so a floating window is created and it is
- * not positioned by the Decorator.
- *
- *******************************************************************/
-
- void BBitMapDoc::BuildWindow (Handle theData)
-
- {
- CScrollPane *theScrollPane;
- BBitMapPane *theMainPane;
- Rect bounds, tRect;
- LongRect bitMapRect;
-
- itsWindow = new(CWindow);
- itsWindow->IWindow(WINDculture, TRUE, gDesktop, this);
- itsWindow->Move(40, 60);
- itsWindow->ChangeSize(screenBits.bounds.right, screenBits.bounds.bottom - 38);
- tRect = screenBits.bounds;
- SetRect(&bounds, 0, 0, tRect.right, tRect.bottom - 38);
- SetLongRect(&bitMapRect, 0, 0, BITMAPWIDTH, BITMAPHEIGHT);
-
- theScrollPane = new(CScrollPane);
-
- theScrollPane->IScrollPane(itsWindow, this, 10, 10, 0, 0,
- sizELASTIC, sizELASTIC,
- TRUE, TRUE, TRUE);
-
- theScrollPane->FitToEnclFrame(TRUE, TRUE);
-
- theMainPane = new(BBitMapPane);
- itsMainPane = theMainPane;
- itsGopher = theMainPane;
-
- theMainPane->IBBitMapPane(theScrollPane, this, bounds.right - SBARSIZE,
- bounds.bottom - SBARSIZE, 0, 0, sizELASTIC, sizELASTIC,
- &bitMapRect, 0L, TRUE);
-
- theScrollPane->InstallPanorama(theMainPane);
-
- gDecorator->PlaceNewWindow(itsWindow);
- }
-
- /************************************************************
- * OutputMap()
- *
- * Initialize bitmap window and output bitmap.
- *
- ***********************************************************/
-
- void BBitMapDoc::OutputMap(BitMap *theBitMap)
- {
- BuildWindow(0L);
- itsWindow->Select();
-
- ((BBitMapPane*)itsMainPane)->InstallBitMap(theBitMap);
-
- EventManagement();
-
- }
-